package com.practice.gmall.realtime.util;

/**
 * ClassName: MySQLUtil
 * Package: com.practice.gmall.realtime.util
 * Description:
 *
 * @Author lzy.ethan@qq.com
 * @Create 2023-02-14 15:55
 */
public class MySQLUtil {

    /**
    * @Description: build the DDL for look-up table base_dic
    * @param
    * @return: java.lang.String DDL
    * @Author: lzy
    * @Date:2023-02-14 - 19:20
    */
    public static String getBaseDicLookUp() {
        return "" +
                "create table base_dic(    " +
                "    dic_code string,  " +
                "    dic_name string,  " +
                "    parent_code string,  " +
                "    create_time string,  " +
                "    operate_time string) "
                 + getLookUpTableDDL("base_dic");
    }

    /**
    * @Description: return LookUp table DDL
    * @param tableName  table to be set to look up table
    * @return: java.lang.String
    * @Author: lzy
    * @Date:2023-02-14 - 18:43
    */
    public static String getLookUpTableDDL(String tableName) {
        return  " with (  " +
                "   'connector' = 'jdbc',    " +
                "   'url' = 'jdbc:mysql://hadoop162:3306/gmall2022?useSSL=false',    " +
                "   'driver' = 'com.mysql.cj.jdbc.Driver',    " +
                "   'table-name' = '" + tableName+"',    " +
                "   'username' = 'root',    " +
                "   'password' = 'aaaaaa',    " +
                "   'lookup.cache.ttl' = '10 minute',    " +
                "   'lookup.cache.max-rows' = '10'    " +
                ")";
    }
}
